import * as fabric from 'fabric'

const canvasEl = document.getElementById("myCanvas3")
const canvas = new fabric.Canvas(canvasEl);


// 失败，图片没有加载出来
fabric.Image.fromURL('../assets/pug.png', function(img) {
  var img1 = img.scale(0.1).set({ left: 100, top: 100 });

  fabric.Image.fromURL('../assets/pug.png', function(img) {
    var img2 = img.scale(0.1).set({ left: 175, top: 175 });

    fabric.Image.fromURL('../assets/pug.png', function(img) {
      var img3 = img.scale(0.1).set({ left: 250, top: 250 });

      canvas.add(new fabric.Group([ img1, img2, img3], { left: 10, top: 20 }))
    });
  });
});
